<template>
	<view class="agency-pay">
		<u-navbar :autoBack="true" titleStyle="color:#fff;" leftIconColor="#fff" title="选购代理"
			bgColor="rgba(255,255,255,0)"></u-navbar>
		<image class="agency-bg" src="https://m.lqvvvv.com/assets/static/my/up-bg.png" mode=""></image>
		<view class="agency-box">
			<view class="agency-title">关于我们</view>
			<view class="agency-cont">
				是一款线上线下相结合的创新社交软件及小程序，打破了传统社交的局限性，拥有非常优秀的
				用户体验!
			</view>
		</view>
		<view class="agency-box">
			<view class="agency-title">选购代理</view>
			<view class="agentlist">
				<view class="activity-item">
				<image src="https://m.lqvvvv.com/images/agent/dl1.png" mode="heightFix"></image>
				</view>
				<view class="activity-item">
					<image src="https://m.lqvvvv.com/images/agent/dl2.png" mode="heightFix"></image>
				</view>
				<view class="activity-item">
					<image src="https://m.lqvvvv.com/images/agent/dl3.png" mode="heightFix"></image>
				</view>
			</view>
			<view class="agency-btn">
				<u-button shape="circle" color="linear-gradient( 90deg, #C58AF0 0%, #6272ED 100%)" type="primary"
					text="招商部联系电话  199 5910 0783" @click="gotel('19959100783')"></u-button>
			</view>
		</view>
		<view class="agency-box">
			<view class="agency-title">代理价格</view>
			<view class="agent-price">
				<view class="price-box">
					经纪人 (5000)币
				</view>
				<view class="tisp">
					<text>·</text> 无需门店，无需坐班，单人可操作<br>
					<text>·</text> 你要做的事：闲暇时挖掘和面试达人，总部提供全程指导<br>
					<text>·</text> 每单可拿8.5%抽成<br>
				</view>
			</view> 
			<view class="agent-price">
				<view class="price-box">
					经销商 (5000)币
				</view>
				<view class="tisp">
					<text>·</text> 无需门店，无需坐班，单人可操作<br>
					<text>·</text> 你要做的事：直播获客，线下推广，商户合作，总部提供全程指导<br>
					<text>·</text> 每单可拿8.5%抽成<br>
				</view>
			</view>
			<view class="agent-price">
				<view class="price-box">
					城市分公司 (50000)币
				</view>
				<view class="tisp">
					<text>·</text> 无需门店，无需坐班，单人可操作<br>
					<text>·</text> 你要做的事：发展经纪人和经销商，挖掘达人和客户，总部全程协助陪跑<br>
					<text>·</text> 每单最高可拿28%抽成<br>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				selse: 0
			}
		},
		onLoad() {
			this.getAgentList();
		},
		methods: {
			gotel(tel) {
				uni.makePhoneCall({
					phoneNumber: tel, // 电话号码
					success: function() {
						console.log('拨打电话成功');
					},
					fail: function() {
						console.log('拨打电话失败');
					}
				});
			},
			gopay() {
				let params = {
					agent_id: this.list[this.selse].id,
					paytype: 'balance',
					// #ifdef APP
					method: 'app',
					// #endif
					// #ifdef H5
					method: 'web',
					// #endif
					// #ifdef MP-WEIXIN
					method: 'miniapp',
					// #endif
				}
				uni.showLoading({
					mask: true
				})
				this.$Request({
					method: 'POST',
					url: '/api/user_agent/buyAgent',
					data: params,
					ismsg: true,
				}).then(res => {
					uni.hideLoading()
					if (res.code == 1) {
						setTimeout(() => {
							uni.switchTab({
								url: '/pages/my/index'
							})
						}, 1000)
					}
				})
			},
			cutshow(index) {
				this.selse = index;
				this.list.forEach((item, i) => {
					item.show = (i === index);
				});
			},
			getAgentList() {
				this.$Request({
					method: 'POST',
					url: '/api/user_agent/getAgentList',
					data: {},
					ismsg: false,
				}).then(res => {
					if (res.code === 1) {
						this.list = res.data.map(item => ({
							...item,
							show: false
						}));
						if (this.list.length > 0) {
							this.list[0].show = true; // 默认显示第一个
						}
					}
				});
			}
		}
	}
</script>

<style scoped lang="scss">
	.agency-pay {
		min-height: 100vh;
		background-color: #2B89FF;

		.agency-bg {
			width: 100%;
			height: 556rpx;
		}

		.agency-box {
			margin: 30rpx;
			padding: 20rpx;
			border-radius: 20rpx;
			background-color: #fff;

			.agent-price {
				padding: 20rpx;

				.price-box {
					font-size: 26rpx;
					font-weight: 900;
					color: red;
				}

				.tisp {
					margin-top: 20rpx;
					font-size: 24rpx;
					line-height: 160%;

					text {
						font-weight: 900;
						margin-right: 10rpx;
					}
				}
			}

			.agency-title {
				font-weight: bold;
				font-size: 28rpx;
				color: #1D295D;
			}

			.agency-cont {
				font-weight: 400;
				font-size: 24rpx;
				color: #19394A;
				margin-top: 20rpx;
			}

			.agency-btn {
				width: 70%;
				margin: 0 auto;
				margin-top: 50rpx;
			}

			.agentlist {
				display: flex;
				justify-content: center;
				justify-content: space-between;
				margin-top: 50rpx;
				padding: 0 20rpx;

				.activity-item {
					image{
						width: 180rpx;
						height: 55rpx;
					}
				}
			}
		}
	}
</style>